/**
 * Created by qian.zhou on 2017/2/23.
 */

var React = require('react');

module.exports = React.createClass({
    getInitialState:function(){
        return {
            goodlist:[]
        }
    },
    componentDidMount:function(){

    },
    action: function (e) {
        var action = e.currentTarget.getAttribute("action");
        location.href = action;
    },
    render:function(){
        var p = this;
        var prolist = localStorage.getItem("goodlist");
        var list = JSON.parse(prolist);
        var aa = 0;
        var goodlist = list.map(function(obj) {
            aa ++;
            var proimg = 'http://115.29.198.39:8080/upload/goods/'+ obj;
            return (
                <div key={aa} className="item" style={{height:"168px"}} onClick={p.action} action="#goodDetail">
                    <div className="pro-img">
                        <img id="pic" src={proimg}/>
                    </div>
                    <div className="pro-msg">
                        <p className="item_title">卡曼24k黄金面膜</p>
                        <p className="item_price" style={{height:"0.5rem"}}></p>
                    </div>
                    <div className="pro-add">
                        <div className="pro_price">
                            <span>￥89</span>
                        </div>
                        <div className="add_pro_cart">
                            <img src="images/g_addcart.jpg"/>
                        </div>
                    </div>
                </div>
            )
        });
        return (
            <div>{goodlist}</div>
        )
    }
});